//剑指 Offer 15. 二进制中1的个数
class Solution {
public:
    int hammingWeight(uint32_t n) {
        int count=0;
        int i=0;
        while(n!=0 && i<32)
        {
            if(n&1==1)
            {
                count++;
            }
            n=n>>1;
            ++i;
        }
        return count;
    }
};